const express = require('express');
const {findBannerService, updateBannerService} = require("../service/bannerService");
const {formatResponse} = require("../utils/tool");
const router = express.Router();

// 获取首页标语
router.get('/', async function (req, res, next) {
    const result = await findBannerService()
    res.send(formatResponse(0, '', result));
})

// 更新首页标语
router.post('/', async function (req, res, next) {
    // console.log(req.body)
    // console.log(req.params.id)
    // console.log(req.query.id)
    await updateBannerService(req.query.id, req.body)
    res.send(formatResponse(0, '更新首页标语成功', {}))
})

module.exports = router;
